#!/usr/bin/env python3
# -*- coding: utf-8 -*-

import configparser
import redis


class PJDogConfig(object):
    def __init__(self, config):
        cf = configparser.ConfigParser()
        cf.read(config)

        self.data_path = cf.get('data', 'data_path')
        self.record_file = cf.get('data', 'record_file')

        self.task_file = cf.get('data', 'task_file')
        self.min_size = cf.getint('data', 'min_size')
        self.task_type = cf.get('data', 'task_type')

        self.post_data = ''

        # redis config
        self.rds_host = cf.get('redis', 'host')
        self.rds_port = cf.getint('redis', 'port')
        self.rds_password = cf.get('redis', 'password')
        self.rds = redis.Redis(host=self.rds_host,
                               port=self.rds_port,
                               db=0,
                               password=self.rds_password,
                               decode_responses=True
                               )


class PJDogSession(object):
    def __init__(self, session, headers, proxy):
        self.session = session
        self.headers = headers
        self.proxy = proxy
